package com.frank.biz.wfwjqktjb.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.frank.common.annotation.Log;
import com.frank.common.enums.BusinessType;
import com.frank.biz.wfwjqktjb.domain.BizWfwjqktjb;
import com.frank.biz.wfwjqktjb.service.IBizWfwjqktjbService;
import com.frank.common.core.controller.BaseController;
import com.frank.common.core.domain.AjaxResult;
import com.frank.common.utils.poi.ExcelUtil;
import com.frank.common.core.page.TableDataInfo;

/**
 * 违纪违法统计Controller
 * 
 * @author frank
 * @date 2024-09-10
 */
@Controller
@RequestMapping("/biz/wfwjqktjb")
public class BizWfwjqktjbController extends BaseController
{
    private String prefix = "biz/wfwjqktjb";

    @Autowired
    private IBizWfwjqktjbService bizWfwjqktjbService;

    @RequiresPermissions("biz:wfwjqktjb:view")
    @GetMapping()
    public String wfwjqktjb()
    {
        return prefix + "/wfwjqktjb";
    }

    /**
     * 查询违纪违法统计列表
     */
    @RequiresPermissions("biz:wfwjqktjb:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(BizWfwjqktjb bizWfwjqktjb)
    {
        startPage();
        bizWfwjqktjb.setCreateBy(getLoginName());
        List<BizWfwjqktjb> list = bizWfwjqktjbService.selectBizWfwjqktjbList(bizWfwjqktjb);
        return getDataTable(list);
    }

    /**
     * 导出违纪违法统计列表
     */
    @RequiresPermissions("biz:wfwjqktjb:export")
    @Log(title = "违纪违法统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(BizWfwjqktjb bizWfwjqktjb)
    {
        bizWfwjqktjb.setCreateBy(getLoginName());
        List<BizWfwjqktjb> list = bizWfwjqktjbService.selectBizWfwjqktjbList(bizWfwjqktjb);
        ExcelUtil<BizWfwjqktjb> util = new ExcelUtil<BizWfwjqktjb>(BizWfwjqktjb.class);
        return util.exportExcel(list, "违纪违法统计数据");
    }

    /**
     * 新增违纪违法统计
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存违纪违法统计
     */
    @RequiresPermissions("biz:wfwjqktjb:add")
    @Log(title = "违纪违法统计", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(BizWfwjqktjb bizWfwjqktjb)
    {
        bizWfwjqktjb.setCreateBy(getLoginName());
        return toAjax(bizWfwjqktjbService.insertBizWfwjqktjb(bizWfwjqktjb));
    }

    /**
     * 修改违纪违法统计
     */
    @RequiresPermissions("biz:wfwjqktjb:edit")
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        BizWfwjqktjb bizWfwjqktjb = bizWfwjqktjbService.selectBizWfwjqktjbById(id);
        mmap.put("bizWfwjqktjb", bizWfwjqktjb);
        return prefix + "/edit";
    }

    /**
     * 修改保存违纪违法统计
     */
    @RequiresPermissions("biz:wfwjqktjb:edit")
    @Log(title = "违纪违法统计", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(BizWfwjqktjb bizWfwjqktjb)
    {
        bizWfwjqktjb.setUpdateBy(getLoginName());
        return toAjax(bizWfwjqktjbService.updateBizWfwjqktjb(bizWfwjqktjb));
    }

    /**
     * 删除违纪违法统计
     */
    @RequiresPermissions("biz:wfwjqktjb:remove")
    @Log(title = "违纪违法统计", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(bizWfwjqktjbService.deleteBizWfwjqktjbByIds(ids));
    }
}
